
package supply;

import java.io.*;

public class product {

    // Initialization of all the variables for the product
    String[] productName=new String[6];
    private int productQuantity;
    private int[] productId=new int[6];
    private int productSelected;
    inventory inv=new inventory();

    // All Readers are initialized to read the User Input
    InputStreamReader is=new InputStreamReader(System.in);
    BufferedReader br=new BufferedReader(is);

    // The Method to Add the products to the Inventory System
    public void addProduct() throws IOException
   {
       for(int i=0;i<6;i++)
       {
       System.out.print("Enter the Product "+i+" : ");
       productName[i]=br.readLine();
       productId[i]=i;
       }
       System.out.println("---------------------------------------------------------------");
       for(int i=0;i<6;i++)
       {
           System.out.println("The Products No "+productId[i]+" is : "+productName[i]);
       }
       System.out.println("<----The Products are successfully added --->");
       Main.starting();
       
   }

   // The Method to get the User Input to select the Product
   public void selectProduct() throws IOException
   {
       System.out.println();
       System.out.print("Enter the Product you want : ");
       productSelected=Integer.parseInt(br.readLine());
       System.out.print("Enter the Quantity you want : ");
       productQuantity=Integer.parseInt(br.readLine());

if(productName != null)
{
       if(productSelected == 0)
       {
           inv.product0(productQuantity);
       }

       else if(productSelected == 1)
       {
           inv.product1(productQuantity);
       }

       else if(productSelected == 2)
       {
           inv.product2(productQuantity);
       }

       else if(productSelected == 3)
       {
           inv.product3(productQuantity);
       }

       else if(productSelected == 4)
       {
           inv.product4(productQuantity);
       }


        else if(productSelected == 5)
       {
           inv.product5(productQuantity);

        }
       
       else
       {
           System.out.println("Please Enter the Correct product....");
       }
}
else

    System.out.println("Please Enter the Product first ....");

}

   // The Method to Display the Products that the are added in the Inventory
    void displayProducts() throws IOException
    {
            System.out.println("The Products the Manufacturer could produce are : ");
            System.out.println("----------------------------------------------");
            System.out.println("Product ID                    Product Name");

        for(int j=0;j<6;j++)
         {
            System.out.println("   "+productId[j]+"                    "+productName[j]);
         }
    
    }
}
